﻿using System;
using System.Collections.Generic;
using System.Text;

namespace daSyntaxAnalyser.SyntaxTree
{
    using daBase.Objects;

    public class AssignmentParamsElement : BlockOfPartOfStandartVariableExpressionElement
    {
        private List<AssignmentParamElement> assignmentparams;

        public List<AssignmentParamElement> AssignmentParams { get { return assignmentparams; } set { assignmentparams = value; } }

        public AssignmentParamsElement(TokenInfo StartInfo, List<AssignmentParamElement> AssignmentParams, List<TokenInfo> Comments)
            : base(StartInfo, Comments)
        {
            assignmentparams = AssignmentParams;
        }

        public override string ToString()
        {
            string result = string.Empty;
            if ((assignmentparams != null) && (assignmentparams.Count > 0))
                result = assignmentparams.Join(", ");
            return string.Format("({0})", result);
        }

        protected override IEnumerator<ISyntaxTreeElement> CreateEnumerator()
        {
            if (assignmentparams != null)
                foreach (AssignmentParamElement assignmentparam in assignmentparams)
                    yield return assignmentparam;
        }
    }
}
